package com.santu.edu.supporter.biz.order.common.pojo.enums;

import com.santu.edu.supporter.exception.BizException;
import com.santu.edu.supporter.exception.CustomError;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author luoyaoqi
 * @createTime 2024/2/29
 * @description
 */
@AllArgsConstructor
@Getter
public enum OrderPayStatusEnum {

    /**
     *
     */

    TO_BE_PAID(0, "待支付"),
    PAID(1, "已支付"),
    CANCELED(2, "已取消"),
    REFUNDING(3, "退款中"),
    REFUNDED(4, "已退款"),
    REFUND_FAILED(5, "退款失败"),;

    private final Integer code;

    private final String desc;



    public static OrderPayStatusEnum convert(Integer code) {
        for (OrderPayStatusEnum e : OrderPayStatusEnum.values()) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        throw BizException.causeBy(CustomError.ENUM_CONVERT_ERROR,"OrderPayStatusEnum转换异常");
    }
}
